<template>
  <el-time-picker v-if="!useVirtual" v-bind="$attrs" v-model="bindValue" @click.stop="" />
  <VTimePicker v-else v-bind="$attrs" v-model="bindValue" @clear="clear"></VTimePicker>
</template>

<script>
  import VTimePicker from '@/components/common/virtual/v-time-picker/index.vue';
  /** 业务组件-自定义时间选择器 */
  export default {
    name: 'MyTimePicker',
    components: {
      VTimePicker,
    },
    inheritAttrs: false,
    props: {
      modelValue: {
        type: [Array, String],
        default() {
          return [];
        },
      },
      useVirtual: {
        // 是否使用单例组件
        type: Boolean,
        default: false,
      },
    },
    emits: ['update:modelValue'],
    data() {
      return {};
    },
    computed: {
      bindValue: {
        get() {
          return this.modelValue;
        },
        set(val) {
          this.$emit('update:modelValue', val);
        },
      },
    },
    // mounted() {
    //   console.log(this.$attrs);
    // },
    methods: {
      clear() {
        this.$emit('update:modelValue', undefined);
      },
    },
  };
</script>

<style lang="scss"></style>
